package com.br.semperparata.components.gui;

import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.Locale;

import javax.swing.JLabel;
import javax.swing.JPanel;

public class DatePicker extends JPanel {
private static final long serialVersionUID = 1L;
	
	private com.michaelbaranov.microba.calendar.DatePicker datePicker;
	private JLabel label = null;
	
	public DatePicker() {
		this (null);
	}
	
	public DatePicker(String label) {
		super(new FlowLayout(FlowLayout.LEADING, 5, 5));
		
		if (label != null) {
			this.label = new JLabel(label);
			this.add(this.label);
		}
		
		datePicker = new com.michaelbaranov.microba.calendar.DatePicker();
		datePicker.setLocale(new Locale("pt"));
		datePicker.setShowNoneButton(false);
		
		this.add(datePicker);
	}
	
	public void setLabelFont(Font font) {
		this.label.setFont(font);
	}
	
	public void setDatePickerFont(Font font) {
		Component[] components =  datePicker.getComponents();
		
		for (Component component : components) {
			component.setFont(font);
		}
	}
	
	public void setFonts(Font font) {
		setLabelFont(font);
		setDatePickerFont(font);
	}
}
